<template>
	<view class="page">
		<view
			class="u-flex user-box u-p-l-30 u-p-r-20 u-p-b-30"
			style="display: flex;margin-left:50rpx;"
		>
			<view class="u-m-r-10">
				<u-avatar
					src="https://skillgo.cn/image/Chargepic/my/write.png"
					size="120"
				/>
			</view>
			<view
				class="u-flex-1"
				style="margin-left: 20rpx;"
			>
				<view
					class="u-font-18 u-p-b-20"
					style="font-size: 40rpx;font-weight: 500;"
				>
					{{userInfor.appNickName}}
				</view>
				<text
					class="u-font-14 u-tips-color"
					style="font-size: 30rpx;font-weight: 400;color:#666666FF ;"
				>
					年级:{{userInfor.grade}}——
				</text>
				<text
					class="u-font-14 u-tips-color"
					style="font-size: 30rpx;font-weight: 400;color:#666666FF ;"
				>
					{{userInfor.major}}
				</text>
			</view>
		</view>
		<view class="funs">
			<view
				v-for="(item,index) in userfunlist"
				:key="index"
				class="item"
				@click="navigate(item.nav)"
			>
				<image :src="item.url" />
				<text>{{item.label}}</text>
				<u-line />
			</view>
		</view>
	</view>
</template>

<script>
import { updateUserinfor, userinfo } from '@/api/api_userInfo.js'
import { setToken, getToken } from '@/store/user.js'
export default {
  data() {
    return {
      show: true,
      //
      iconStyle: { 'fontSize': '40rpx', 'width': '40rpx' },
      userInfor: {},
      userfunlist: [{ label: '信息修改', url: 'https://skillgo.cn/image/Chargepic/my/write.png', nav: '/packages/Myinfor/Myview/info' }]
    }
  },

  created() {
    this.getuserinfor()
  },
  methods: {
    // 获取用户数据
    async getuserinfor() {
      const token = getToken()
      const res = await userinfo(token)

      this.userInfor = res
      console.log(res)
    },
    //
    navigate(item) {
      console.log('sdf')
      uni.navigateTo({
        url: item
      })
    },
    change() {
      wx.setBackgroundColor({
				  backgroundColor: '#111111', // 窗口的背景色为白色
      })

      wx.setBackgroundColor({
				  backgroundColorTop: '#111111', // 顶部窗口的背景色为白色
				  backgroundColorBottom: '#111111', // 底部窗口的背景色为白色
      })
    }
  }
}
</script>

<style lang="scss">
#page{
	padding:50rpx;
	background-color: #ededed;
}
.u-flex{
	background: #f8f8f8;
	margin-top: 50rpx;
	border-bottom: solid #f8f8f8;
}
.funs{
	background: white;
	display: flex;
	.item{
		display: flex;
		line-height: 70rpx;
		margin-left: 30rpx;
		margin-top: 20rpx;
		position: relative;

		border-bottom: solid #f8f8f8;
		text{

			line-height: 120rpx;
			margin-left: 25rpx;
			font-size: 35rpx;
			font-weight: 500;
			margin-top: -12rpx;
		}
		image{
		width:60rpx ;
		height: 60rpx;
		margin-top: 10rpx;
	}
	}

}
.user-box{
	background-color: #fff;
}
</style>

